package com.cheng.controller;

import com.cheng.common.exception.CommonException;
import com.cheng.common.results.DataRslt;
import com.cheng.data.vo.ExceptionVO;
import com.cheng.data.vo.ReqPageInfoVO;
import com.cheng.data.vo.RespPageInfoVO;
import com.cheng.operation.ExceptionOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: ChengJW
 * @date: 2021/11/13 10:21
 * @version: 1.0
 * @description: 异常日志处理器
 */
@Controller
public class ExceptionController extends BaseController{

    private final static Logger log = LoggerFactory.getLogger(ExceptionController.class);

    @Autowired
    private ExceptionOperation exceptionOperation;

    @RequestMapping("/systemDefend/exceptionAdmin")
    public String ExceptionAdmin(){
        return "exceptionAdmin";
    }


    /**
    * @author: ChengJW
    * @params: [exceptionVO]
    * @return: com.cheng.common.results.DataRslt
    * @date: 2021/11/13
    * @description: 查询系统异常日志信息列表，并封装成 layui 框架所需要的格式返回给前端
    */
    @RequestMapping("/systemDefend/exceptionAdmin/selectExceptionInfo")
    @ResponseBody
    public DataRslt selectExceptionInfo(ReqPageInfoVO reqPageInfoVO) throws CommonException{

        reqPageInfoVO.setUserCode(getUrCode());
        RespPageInfoVO respPageInfoVO = exceptionOperation.selectExceptionInfoList(reqPageInfoVO);
        return tabSuccess(respPageInfoVO);
    }
}
